<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8" />
  <!--移动端的预览设置-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link href="../../static/images/favicon.ico" th:href="@{/images/me.png}" rel="icon" type="image/x-ico">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}" />
  <title>相册新增</title>
</head>
<body>

<!--导航栏-->
  <nav class="ui inverted gird-header m-opacity-tiny ">
  <div class="ui container">
    <div class="ui inverted secondary stackable menu">
      <h2 class="ui teal header item">后台管理</h2>
      <a href="#" th:href="@{/admin/blogs}" class=" m-item item m-mobile-hide"><i class="home icon"></i>文章管理</a>
      <a href="#" th:href="@{/admin/types}" class=" m-item item m-mobile-hide"><i class="clone outline icon"></i>分类管理</a>
      <a href="#" th:href="@{/admin/tags}" class=" m-item item m-mobile-hide"><i class="tags icon"></i>标签管理</a>
      <a href="#" th:href="@{/admin/friendlinks}" class="  m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链管理</a>
      <a href="#" th:href="@{/admin/pictures}" class="active m-item item m-mobile-hide"><i class="image icon"></i>相册管理</a>
      <div class="right m-item m-mobile-hide menu">
        <div class="ui dropdown  item">
          <div class="text">
            <img class="ui avatar image" src="../../static/images/me.png" th:src="@{/images/me.png}">
            <span class="m-text-thin">Mr.ou</span>
          </div>
          <i class="dropdown icon"></i>
          <div class="menu">
            <a href="#" th:href="@{/admin/logout}" class="item">注销</a>
          </div>
        </div>
      </div>
    </div>
  </div>
  <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
    <i class="sidebar icon"></i>
  </a>
</nav>

  <div class="m-padded-tb-hugex">
    <div class="ui attached pointing menu">
      <div class="ui container">
        <div class="right menu">
          <a href="#" th:href="@{/admin/pictures/input}" class="teal active item">新增</a>
          <a href="#" th:href="@{/admin/pictures}" class="item">列表</a>
        </div>
      </div>
    </div>
  </div>

  <!--中间内容-->
  <div  class="m-container-small m-padded-tb-massive">
    <div class="ui container">
      <form action="#" method="post" th:action="*{id}==null ? @{/admin/pictures} : @{/admin/pictures/{id}(id=*{id})} " th:object="${picture}" class="ui form">
        <input type="hidden" name="id" th:value="*{id}">
        <div class=" field">
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">图片名称</label>
            <input type="text" name="picturename" placeholder="图片名称" th:value="*{picturename}">
          </div>
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">时间地点</label>
            <input type="text" name="picturetime" placeholder="时间地点" th:value="*{picturetime}">
          </div>
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">图片地址</label>
            <input type="text" name="pictureaddress" placeholder="图片地址" th:value="*{pictureaddress}">
          </div>
          <div class="ui left labeled input m-margin-top">
            <label class="ui teal basic label">图片描述</label>
            <input type="text" name="picturedescription" placeholder="图片描述" th:value="*{picturedescription}">
          </div>
        </div>

        <div class="ui error message"></div>
        <!--/*/
          <div class="ui negative message" th:if="${#fields.hasErrors('picturename')}">
            <i class="close icon"></i>
            <div class="header">验证失败</div>
            <p th:errors="*{picturename}">提交信息不符合规则</p>
          </div>
        /*/-->
        <div class="ui right aligned container">
          <button type="button" class="ui button" onclick="window.history.go(-1)" >返回</button>
          <button class="ui teal submit button">提交</button>
        </div>

      </form>
    </div>
  </div>

  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <!--底部栏-->
  <footer class="ui inverted vertical segment m-padded-tb-massive m-opacity">
    <div class="ui center aligned container">
      <!--grid 将模块分为16份  divided分割线-->
      <div class="ui inverted divided stackable grid">

        <div class="four wide column">
          <div class="ui inverted link list">
            <h4 class="ui inverted header m-text-spaced m-opacity-mini">欢迎打赏(微信)</h4>
            <div class="item">
              <img src="../../static/images/weixin.png" th:src="@{/images/weixin.png}"  class="ui rounded image" alt="" style="width: 110px">
            </div>
          </div>
        </div>

        <div class="four wide column">
          <h4 class="ui inverted header m-text-spaced m-opacity-mini">其它博客地址</h4>
          <div class="ui inverted link list">
            <a href="#" class="item">掘金</a>
            <a href="#" class="item">CSDN</a>
            <a href="#" class="item">OSCHINA</a>
          </div>
        </div>

        <!--联系我-->
        <div class="four wide column">
          <h4 class="ui inverted header m-text-spaced m-opacity-mini">联系我</h4>
          <div class="ui inverted link list">
            <div href="#" class="item">QQ：1032423474</div>
            <div href="#" class="item">Email：itoldou@foxmail.com</div>
            <div href="#" class="item">Wechat：浪过、涛自在~</div>
          </div>
        </div>



        <div class="four wide column">
          <h4 class="ui inverted header m-text-spaced m-opacity-mini">Self-Introduce</h4>
          <p class="m-text-thin m-text-spaced m-opacity-mini">这是我的个人博客,我会在这里分享一些关于编程、写作、学习笔记、个人思考的相关内容，希望对来到这里的人有所帮助！</p>
        </div>

      </div>

      <!--最底部的线-->
      <div class="ui inverted section divider"></div>
      <div style="color: darkorange;margin-top: -18px" class="ui inverted m-text-thin m-text-spaced">Mr.ou's blog 已营业：<span id="htmer_time" class="item"></span>٩(๑òωó๑)۶</div>
      <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright @ 2020- 2020 OuJiangTao Designed by OuJiangTao</p>

    </div>
  </footer>

  <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>

  <script>

      $('#blog-message').load(/*[[@{/footer/blogmessage}]]*/"/footer/blogmessage");


      $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
      });

      $('.ui.dropdown').dropdown({
        on : 'hover'
      });

      $('.ui.form').form({
        fields : {
          title : {
            identifier: 'pictureaddress',
            rules: [{
              type : 'empty',
              prompt: '请输入照片地址'
            }]
          }
        }
      });
      // 运行时间统计
      function secondToDate(second) {
        if (!second) {
          return 0;
        }
        var time = new Array(0, 0, 0, 0, 0);
        if (second >= 365 * 24 * 3600) {
          time[0] = parseInt(second / (365 * 24 * 3600));
          second %= 365 * 24 * 3600;
        }
        if (second >= 24 * 3600) {
          time[1] = parseInt(second / (24 * 3600));
          second %= 24 * 3600;
        }
        if (second >= 3600) {
          time[2] = parseInt(second / 3600);
          second %= 3600;
        }
        if (second >= 60) {
          time[3] = parseInt(second / 60);
          second %= 60;
        }
        if (second > 0) {
          time[4] = second;
        }
        return time;
      }
      function setTime() {
        /*此处为网站的创建时间     new Date(Date.UTC(year, month - 1, day, hour, minute, second))*/
        var create_time = Math.round(new Date(Date.UTC(2020, 06, 17, 15, 00, 15)).getTime() / 1000);
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
        currentTime = secondToDate((timestamp - create_time));
        currentTimeHtml = currentTime[0] + '年' + currentTime[1] + '天'
                + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
                + '秒';
        document.getElementById("htmer_time").innerHTML = currentTimeHtml;
      }
      setInterval(setTime, 1000);
  </script>
</body>
</html>